/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Daniel
 */
@Entity
@Table(name = "horasreserva")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Horasreserva.findAll", query = "SELECT h FROM Horasreserva h"),
    @NamedQuery(name = "Horasreserva.findByIdHorasReservas", query = "SELECT h FROM Horasreserva h WHERE h.idHorasReservas = :idHorasReservas"),
    @NamedQuery(name = "Horasreserva.findByHorasReservas", query = "SELECT h FROM Horasreserva h WHERE h.horasReservas = :horasReservas")})
public class Horasreserva implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_horas_reservas")
    private Integer idHorasReservas;
    @Size(max = 5)
    @Column(name = "horas_reservas")
    private String horasReservas;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "horasReserva")
    private List<Reservas> reservasList;

    public Horasreserva() {
    }
/**
     * Metodo accesor 
     *
     * @return
     */
    public Horasreserva(Integer idHorasReservas) {
        this.idHorasReservas = idHorasReservas;
    }
/**
     * Metodo accesor 
     *
     * @return
     */
    public Integer getIdHorasReservas() {
        return idHorasReservas;
    }

    public void setIdHorasReservas(Integer idHorasReservas) {
        this.idHorasReservas = idHorasReservas;
    }

    public String getHorasReservas() {
        return horasReservas;
    }
/**
     * Metodo accesor 
     *
     * @return
     */
    public void setHorasReservas(String horasReservas) {
        this.horasReservas = horasReservas;
    }
/**
     * Metodo accesor 
     *
     * @return
     */
    @XmlTransient
    public List<Reservas> getReservasList() {
        return reservasList;
    }
/**
     * Metodo accesor 
     *
     * @return
     */
    public void setReservasList(List<Reservas> reservasList) {
        this.reservasList = reservasList;
    }
/**
     * Metodo accesor 
     *
     * @return
     */
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idHorasReservas != null ? idHorasReservas.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Horasreserva)) {
            return false;
        }
        Horasreserva other = (Horasreserva) object;
        if ((this.idHorasReservas == null && other.idHorasReservas != null) || (this.idHorasReservas != null && !this.idHorasReservas.equals(other.idHorasReservas))) {
            return false;
        }
        return true;
    }
/**
     * Metodo accesor 
     *
     * @return
     */
    @Override
    public String toString() {
        return horasReservas;
    }
    
}
